package com.flea.hclv.controller;

import com.flea.hclv.util.ServerResponse;
import com.flea.hclv.util.share.WeinXinUtil;
import com.flea.hclv.util.share.WinXinEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @program: project
 * @description: 微信分享
 * @author: shiliqiang
 * @create: 2018-12-13 10:53
 * @version: 1.0
 */
@RequestMapping("/flea/wx/")
@Controller
public class WxShareController {


    @RequestMapping(value = "share",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse<WinXinEntity> share(HttpServletRequest request){
//        JSONArray jsonArray= JSON.parseArray(url);
//        String url1= (String)jsonArray.get(0);
        //微信分享
        String strUrl = "http://www.imflea.cn/hclv-web"
                + request.getContextPath()   //项目名称
                + request.getServletPath()   //请求页面或其他地址
                + "?" + (request.getQueryString()); //参数
        WinXinEntity wx = WeinXinUtil.getWinXinEntity(strUrl);
        return ServerResponse.createBySuccess(wx);
    }
}
